<template>
  <div class="table-button">
    <div
      v-for="item in list"
      class="table-button-detail"
      :key="item.text">
      <Poptip
        v-if="item.isPop"
        confirm
        transfer
        placement="left"
        :title="`您确定要${item.text}这条记录吗？`"
        @on-ok="item.clickFn">
        <CustomButton
          size="small"
          :type="item.type"
          :disabled="item.disabled">
          {{item.text}}
        </CustomButton>
      </Poptip>
      <CustomButton
        v-else
        size="small"
        :type="item.type"
        :disabled="item.disabled"
        @click="item.clickFn">
        {{item.text}}
      </CustomButton>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    list: {
      type: Array,
      default: () => []
    }
  }
}
</script>

<style lang="scss" scoped>
  .table-button {
    width: 100%;
    display: flex;
    align-items: center;
    > .table-button-detail {
      margin-right: 5px;
      &:nth-last-of-type(1) {
        margin-right: 0;
      }
      > .custom-button {
        min-width: auto;
      }
    }
  }
</style>
